import { Tooltip } from 'antd';
import { QuestionCircleOutlined } from '#/utils/antdIcons.js';

export const SELECT_DATA = ['交易单元', '日期', '时点'];
export const OPTION_KEY = {
  交易单元: 'stationName',
  日期: 'date',
  时点: 'timeOrder',
};

export const UNIT_TYPE_OPTIONS = [
  { label: '全部', value: 0 },
  { label: '风电', value: 3 },
  { label: '光伏', value: 4 },
];

export const headerMap = {
  '综合结算-现货结算电费': 'totalStatementEnergyIncome',
  '综合结算-现货结算电量': 'totalStatementEnergyQuantity',
  '综合结算-结算均价': 'totalStatementEnergyPrice',
  '中长期市场-中长期电量': 'longQuantity',
  '中长期市场-中长期电价': 'longPrice',
  '中长期市场-中长期电费': 'longIncome',
  '省间日前现货市场-省间日前现货电量': 'transprovincialDayaheadSpotQuantity',
  '省间日前现货市场-省间日前现货电价': 'transprovincialDayaheadSpotPrice',
  '省间日前现货市场-省间日前现货电费': 'transprovincialDayaheadSpotIncome',
  '省间日内现货市场-省间日内现货电量': 'transprovincialRealtimeSpotQuantity',
  '省间日内现货市场-省间日内现货电价': 'transprovincialRealtimeSpotPrice',
  '省间日内现货市场-省间日内现货电费': 'transprovincialRealtimeSpotIncome',
  '省内实时现货市场-竞价中标电量': 'realtimeSpotQuantity',
  '省内实时现货市场-竞价中标电价': 'realtimeSpotPrice',
  '省内实时现货市场-竞价中标电费': 'realtimeSpotIncome',
  '省内实时现货市场-实时偏差电量': 'realtimeDeviationQuantity',
  '省内实时现货市场-实时偏差电费': 'realtimeDeviationIncome',
};

export const CODE1 = 'title';

export const columns = [
  {
    name: '',
    align: 'left',
    code: CODE1,
    width: 130,
    lock: true,
  },
  {
    name: (
      <>
        <Tooltip title={'数据更新时间为每天早上08:00'}>
          <QuestionCircleOutlined style={{ color: '#FD4F43', marginRight: 4 }} />
        </Tooltip>
        综合结算
      </>
    ),
    children: [
      {
        name: '现货结算电费',
        code: 'totalStatementEnergyIncome',
      },
      {
        name: '现货结算电量',
        code: 'totalStatementEnergyQuantity',
      },
      {
        name: '结算均价',
        code: 'totalStatementEnergyPrice',
      },
    ],
  },
  {
    name: '中长期市场',
    children: [
      {
        name: '中长期电量',
        code: 'longQuantity',
      },
      {
        name: '中长期电价',
        code: 'longPrice',
      },
      {
        name: '中长期电费',
        code: 'longIncome',
      },
    ],
  },
  {
    name: '省间日前现货市场',
    children: [
      {
        name: '省间日前现货电量',
        code: 'transprovincialDayaheadSpotQuantity',
      },
      {
        name: '省间日前现货电价',
        code: 'transprovincialDayaheadSpotPrice',
      },
      {
        name: '省间日前现货电费',
        code: 'transprovincialDayaheadSpotIncome',
      },
    ],
  },
  {
    name: '省间日内现货市场',
    children: [
      {
        name: '省间日内现货电量',
        code: 'transprovincialRealtimeSpotQuantity',
      },
      {
        name: '省间日内现货电价',
        code: 'transprovincialRealtimeSpotPrice',
      },
      {
        name: '省间日内现货电费',
        code: 'transprovincialRealtimeSpotIncome',
      },
    ],
  },
  {
    name: '省内实时现货市场',
    children: [
      {
        name: '竞价中标电量',
        code: 'realtimeSpotQuantity',
      },
      {
        name: '竞价中标电价',
        code: 'realtimeSpotPrice',
      },
      {
        name: '竞价中标电费',
        code: 'realtimeSpotIncome',
      },
      {
        name: '实时偏差电量',
        code: 'realtimeDeviationQuantity',
      },
      {
        name: '实时偏差电费',
        code: 'realtimeDeviationIncome',
      },
    ],
  },
].map((t) => ({
  ...t,
  align: t.align || 'center',
  render: t.render ?? ((v) => v ?? '-'),
  children: t.children?.map((c) => ({
    ...c,
    align: 'center',
    render: c.render ?? ((v) => v ?? '-'),
    width: 100,
    features: {
      sortable: true,
    },
  })),
}));

export const seriseMap = {
  totalStatementEnergyQuantity: {
    name: '综合电量',
    type: 'bar',
    color: '#0A84FF',
    props: {
      barCategoryGap: 0,
    },
  },
  totalStatementEnergyPrice: {
    name: '综合电价',
    type: 'line',
    color: '#64D2FF',
    props: {
      yAxisIndex: 1,
      symbol: 'circle',
    },
  },

  longQuantity: {
    type: 'bar',
    name: '中长期电量',
    color: '#0A84FF',
    props: { stack: 'one' },
  },
  transprovincialDayaheadSpotQuantity: {
    type: 'bar',
    name: '省间日前现货电量',
    color: '#64D2FF',
    props: { stack: 'one' },
  },
  transprovincialRealtimeSpotQuantity: {
    type: 'bar',
    name: '省间日内现货电量',
    color: '#30D180',
    props: { stack: 'one' },
  },
  realtimeSpotQuantity: {
    type: 'bar',
    name: '竞价中标电量',
    color: '#FFA71F',
    props: { stack: 'one' },
  },

  longPrice: {
    name: '中长期电价',
    type: 'line',
    color: '#0A84FF',
    props: {
      symbol: 'circle',
      smooth: true,
    },
  },

  transprovincialDayaheadSpotPrice: {
    name: '省间日前现货电价',
    type: 'line',
    color: '#64D2FF',
    props: {
      symbol: 'circle',
      smooth: true,
    },
  },
  transprovincialRealtimeSpotPrice: {
    name: '省间日内现货电价',
    type: 'line',
    color: '#30D180',
    props: {
      smooth: true,
      symbol: 'circle',
    },
  },
  realtimeSpotPrice: {
    name: '竞价中标电价',
    type: 'line',
    color: '#FFA71F',
    props: {
      smooth: true,
      symbol: 'circle',
    },
  },
};
export const chartsMap = {
  场站总览: ['totalStatementEnergyQuantity', 'totalStatementEnergyPrice'],
  电量分析: [
    'longQuantity',
    'transprovincialDayaheadSpotQuantity',
    'transprovincialRealtimeSpotQuantity',
    'realtimeSpotQuantity',
  ],
  电价分析: [
    'longPrice',
    'transprovincialDayaheadSpotPrice',
    'transprovincialRealtimeSpotPrice',
    'realtimeSpotPrice',
  ],
};

export const yAxisMap = {
  场站总览: [
    {
      type: 'value',
      name: 'MWh',
    },
    {
      type: 'value',
      name: '元/MWh',
    },
  ],
  电量分析: [
    {
      type: 'value',
      name: 'MWh',
    },
  ],
  电价分析: [
    {
      type: 'value',
      name: '元/MWh',
    },
  ],
};
